﻿@{
    ViewData["Title"] = "login";
    Layout = "_LoginLayout";
}

<div class="row-fluid">
    <div class="dialog">
        <div class="block">
            <p class="block-heading">管理员登录</p>
            <div class="block-body">
                <form asp-action="Index" method="post">
                    <div>
                        <label>用户名<span class="my-error" id="error">我是错误提示</span></label>
                        <input type="text" name="name" placeholder="User name" class="span12 auth">
                    </div>
                    <div>
                        <label>密码</label>
                        <input type="password" name="password" placeholder="Password" class="span12 auth">
                    </div>
                    <input type="submit" class="btn btn-primary pull-right" value="登录">
                    <label class="remember-me"><input type="checkbox"> 记住我的选择</label>
                    <div class="clearfix"></div>
                </form>
            </div>
        </div>
    </div>
</div>




<script type="text/javascript">
    $('auth').data({ 's': 0 });

    $('input:first').focus();

    $('input[name = name]').focus(function () {
        $(this).attr('placeholder', '请输入用户名')        
    });

    $('input[name = name]').blur(function () {
        val = this.value;
        if (val.length == 0) {
            
            $(this).attr('placeholder', '用户名不能为空')
            $(this).data({ 's': '0' })
        }
        else {
            $(this).data({ 's': '1' })
        }
    });

    $('input[name = password]').focus(function () {
        $(this).attr('placeholder', '请输入密码')
    });

    $('input[name = password]').blur(function () {
        val = this.value;
        if (val.length == 0) {

            $(this).attr('placeholder', '密码不能为空')
            $(this).data({ 's': '0' })
        }
        else {
            $(this).data({ 's': '1' })
        }
    });


    $('form').submit(function () {
        $('.auth').blur();
        tot = 0;
        $('.auth').each(function () {
            if ($(this).data('s') == 1) {
                tot += 1;
            }
        });

        if (tot == 2) {
            return true;
        }

        return false;
    });
</script>

